package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._1工厂模式._计算器3;

/**
 * @ClassName Operation
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/9 8:10 PM
 * @Version 1.0
 */
public class Operation {
    public static double getResult(double numberA, double numberB, String operate) {
        double result = 0d;
        switch (operate) {
            case "+":
                result = numberA + numberB;
                break;
            case "-":
                result = numberA - numberB;
                break;
            case "*":
                result = numberA * numberB;
                break;
            case "/":
                result = numberA / numberB;
                break;
            case "pow":
                result= Math.pow(numberA,numberB);
                break;
        }
        return result;

    }
}
